Skip to content

Restore .git pointer file backup for agents that delete it#145

Merged
that-github-user merged 1 commit into
mainfrom
fix-136-git-file-restore
Mar 29, 2026
Merged

Restore .git pointer file backup for agents that delete it#145
that-github-user merged 1 commit into
mainfrom
fix-136-git-file-restore

Conversation

@that-github-user

Copy link
Copy Markdown
Owner

Summary

PR #144 added worktree locking to prevent gc pruning. But the .git POINTER FILE in the worktree is still being deleted by agents (they have Bash access). This adds the backup/restore mechanism back alongside the lock.

Both protections:

  • Lock → prevents gc from pruning .git/worktrees/NAME/
  • Backup → restores .git pointer file if agent deletes it

Change type

  • Bug fix

Related issue

Further fix for #136

How to test

npm test  # 237 tests pass
thinktank run --attempts 3 --model opus "review README.md"
# Agents should show file changes

Breaking changes

  • This PR introduces breaking changes

The worktree lock (#144) protects .git/worktrees/NAME/ from gc pruning.
But agents with Bash/Write access can still delete the .git POINTER FILE
from the worktree directory itself. This backup/restore catches that case.

Both protections together:
- Lock → prevents gc from pruning metadata directory
- Backup → restores pointer file if agent deletes it

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@that-github-user that-github-user merged commit 4f1b651 into main Mar 29, 2026
4 checks passed
@that-github-user that-github-user deleted the fix-136-git-file-restore branch March 29, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant